package kr.hkit.powerjava.chapter22.work3;

import java.util.ArrayList;
import java.util.Collections;

public class Programming_5 {
	public static void main(String[] args) {
		ArrayList<Double> list= new ArrayList<Double>();
		//10개의 점수를 입력받기
		list.add(1.2); list.add(6.2);
		list.add(7.2); list.add(8.2);
		list.add(9.2); list.add(9.9); 
		list.add(2.2); list.add(3.2);
		list.add(4.2); list.add(5.2);
		
		System.out.println(list);//출력
		
		System.out.println(list.get(list.indexOf(Collections.max(list)))); //최고
		System.out.println(list.get(list.indexOf(Collections.min(list)))); //최저
		
		double getTotal = 0;
		
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i)!=Collections.max(list) && list.get(i)!=Collections.min(list)) {
				getTotal = getTotal + list.get(i);
				}
		}
		
		
		/*for (int i=0; i<list.size();i++) {
			getTotal = getTotal + list.get(i);
		}*/
		System.out.println(getTotal);
		
	}
}
